let userInfo = [
    {
        userId: 1,
        userName: 'cding',
        password: '123456'
    }
];

function checkpassword(username, password) {
    for (let i = 0; i < userInfo.length; i++) {
        if (userInfo[i].userName == username&&userInfo[i].password == password){
            return userInfo[i].userId;
        }
    }
    return false;
}
function getUserInfo(userId) {
    let user = userInfo.filter(function (item) {
        if (userId == item.userId) return true;
        return false;
    });
    return user[0];
}
module.exports = {
    checkpassword,
    getUserInfo
}